<%@ page import="java.util.List" %>
<%@ page import="com.elonnx.entity.Student" %>
<%@ page contentType="text/html; charset=utf-8" language="java" %>
<html>
    <head>
        <link href="${pageContext.request.contextPath}/static/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
        <script src="${pageContext.request.contextPath}/static/jquery/jquery-1.12.4.min.js"></script>
        <script src="${pageContext.request.contextPath}/static/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
        <script>
            $(function(){
                $(".btn-add").click(function(){
                    window.location.href = "${pageContext.request.contextPath}/student/addUI";
                });
            });
        </script>
    </head>

    <body>
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <h1>学生管理系统</h1>
                </div>
            </div>
            <div class="row">
                <div class="col-md-4 col-md-offset-10">
                    <button type="button" class="btn btn-primary btn-add">新增</button>
                </div>
            </div>
            <div class="row">
                <div class="col-md-12">
                    <table class="table table-striped table-hover table-bordered">
                        <thead>
                            <tr>
                                <td>ID</td>
                                <td>姓名</td>
                                <td>年龄</td>
                                <td>性别</td>
                                <td>生日</td>
                                <td>生活费</td>
                            </tr>
                        </thead>
                        <tbody>
                            <%
                                List<Student> list = (List<Student>) request.getAttribute("studentList");
                                for (Student s : list) {
                            %>
                            <tr>
                                <td><%=s.getId()%></td>
                                <td><%=s.getName()%></td>
                                <td><%=s.getAge()%></td>
                                <td><%=s.getGender()%></td>
                                <td><%=s.getBirthday()%></td>
                                <td><%=s.getMoney()%></td>
                            </tr>
                            <%
                                }
                            %>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </body>
</html>